<?php

namespace app\order\controller;

use app\api\logic\TestLogic;
use app\common\controller\PCBase;
use app\common\controller\DBase;
use app\BaseController;
use app\order\logic\OrderdeliverLogic;
use app\order\logic\OrderShipLogic;
use think\facade\Db;
use Throwable;
use app\common\library\Upload;

class Orderdeliver extends PCBase
{


    public function initialize(): void
    {
        parent::initialize();
    }

    /**
     * index
     * @throws Throwable
     */
    public function index()
    {
        $params     = $this->request->post();
        $OrderdeliverLogic = new OrderdeliverLogic();
        return $OrderdeliverLogic->index($params);
    }

    /**
     * export
     * @throws Throwable
     */
    public function export()
    {
        $params     = $this->request->post();
        $OrderdeliverLogic = new OrderdeliverLogic();
        return $OrderdeliverLogic->export($params);
    }
    /**
     * export
     * @throws Throwable
     */
    public function uploads()
    {
        $file   = $this->request->file('file');
        $tel    = $this->getAdminTel();
        $data['file'] = $file;
        $data['tel']  = $tel;
        (new TestLogic())->uploadExcelTest($data);
        return  $this->jsonMessage(200,true,'文件异步上传成功,等待一会可以查看结果!',null);
    }
    /**
     * export
     * @throws Throwable
     */
    public function automatic_shipping()
    {
        $params     = $this->request->post();
        $OrderShipLogic = new OrderShipLogic();
        return $OrderShipLogic->automaticShipping($params);
    }


    /**
     * @desc   获取日志详情数据
     * @author xx
     * @date   2024-07-12
     */
    public function getInfo(){
        $params         = $this->request->post();
        $OrderShipLogic = new OrderShipLogic();
        return $OrderShipLogic->getInfo($params);
    }



    /**
     * @desc   标记已处理
     * @author xx
     * @date   2024-07-15
     */
    public function endShipping(){
        $params = $this->request->post();
        $orderShipLogic = new OrderShipLogic();
        return $orderShipLogic->endShipping($params);
    }

    /**
     * @desc   批量修改为已处理
     * @author zh
     * @date   2024-07-15
     */
    public function MarkAsProcessed()
    {
        $params     = $this->request->post();
        $OrderShipLogic = new OrderShipLogic();
        return $OrderShipLogic->MarkAsProcessed($params);
    }

}
